package com.pro.addresslist.ui.activity;


import java.util.ArrayList;
import java.util.List;

import com.pro.addresslist.R;
import com.pro.addresslist.ui.common.BaseActivity;
import com.pro.addresslist.ui.view.PopMenu;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.TextView;
import android.widget.Toast;


public class MainActivity extends BaseActivity {
	private List<Object[]> listitm=new ArrayList<Object[]>();
	private PopMenu pop;
	private TextView dddd;


	@Override
	public int getLayout() {
		// TODO Auto-generated method stub
		return R.layout.activity_main;
	}


	@Override
	public void OnActCreate(Bundle savedInstanceState) {
		
		//设置标题
		setTtile("主页");
		setRightText("菜单", this);
		setViewClick(R.id.tv_title_right_text);
		
		dddd=(TextView) findViewById(R.id.tv_title_right_text);
		
        listitm.add(new Object[]{"dasd"});
        listitm.add(new Object[]{"dasd"});
        listitm.add(new Object[]{"dasd"});
        
        
//      	ScaleAnimation animation_suofang =new ScaleAnimation(1.0f, 0.85f, 1.0f, 0.85f, 
//      	Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); 		
//      		animation_suofang.setDuration(700);						//执行时间
//      		animation_suofang.setRepeatCount(-1);					//重复执行动画
//      		animation_suofang.setRepeatMode(Animation.REVERSE);   	//重复 缩小和放大效果
//      		dddd.startAnimation(animation_suofang);				//使用View启动动画
        
        
	}


	@Override
	public void OnViewClick(View v) {
		switch (v.getId()) {
		case R.id.tv_title_right_text:
			pop=new PopMenu(MainActivity.this, R.layout.test,R.id.listv,R.layout.test_itmes,listitm,R.id.d1,0,200);
			pop.showAsDropDown(dddd,0,0,true);
			pop.setOnItemClickListener(new OnItemClickListener() {

				@Override
				public void onItemClick(AdapterView<?> arg0, View arg1,
						int arg2, long arg3) {
					Toast.makeText(MainActivity.this, arg2+"", Toast.LENGTH_SHORT).show();

				}
			});
			break;
		}
		
	}


   
}
